package cn.icare.cms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;

//import org.mybatis.spring.annotation.MapperScan;//生成通用mapper时是需要用下面tk的MapperScan

/**
 * 依赖注入是按照包名逐级向下查找，所以依赖注入的类要在这个类的同级或下级包中才可以被注入
 */
@MapperScan(basePackages = "cn.icare.cms.dao.mapper")
@SpringBootApplication
@ServletComponentScan //开启注解自动注册,如@Controller,@Commpent注解的类自动注册的启动服务中
@EnableScheduling //启动定时任务的功能
@EnableEurekaClient //设置为EurekaClient客户端
@EnableFeignClients //启动负载均衡功能
@EnableHystrix //开启熔错器功能
public class AppWebApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(AppWebApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AppWebApplication.class);
    }

}
